package com.wzy.mall.web.servlet.admin;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/admin/order/*")
public class OrderServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String requestURI = request.getRequestURI();
        String action = requestURI.replace("/api/admin/order/", "");
        if("ordersByPage".equals(action)) {
            Order.ordersByPage(request, response);

        } else if("order".equals(action)) {
            Order.getOrder(request, response);

        } else if("deleteOrder".equals(action)) {
            Order.deleteOrder(request, response);

        } else if("changeOrder".equals(action)) {
            Order.changeOrder(request, response);

        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
